package poly_detail02;

public class PolyDetail02 {
    public static void main(String[] args) {
        Base base = new Sub();//base的编译类型是Base
        //向上转型，父类的引用-->一个子类的对象
        System.out.println(base.count);//看编译类型 10
        Sub sub = new Sub();
        System.out.println(sub.count);//20
    }
}
//属性没有重写之说，属性的值看编译类型
class Base {//父类
    int count = 10;
}
class Sub extends Base {
    int count = 20;
}
